<%--
    Document   : warehouses
    Created on : Nov 6, 2009, 1:18:13 AM
    Author     : moustafa
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.*" %>
<%@page import="model.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">


<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Warehouses</title>
    </head>
    <body>
        <table border="1" cellspacing="1" cellpadding="1">
            <thead>
                <tr>
                    <th>Warehouse Name</th>
                    <th>Product Name</th>
                    <th>Quantity</th>
                    <th>Edit Inventory</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                </tr>
                <%
                ArrayList <Inventory> inventories = (ArrayList <Inventory>)request.getSession(false).getAttribute("inventories");
                Iterator<Inventory> inventoriesItr = inventories.iterator();
                while(inventoriesItr.hasNext()){
                Inventory inventory = inventoriesItr.next();
                 %>

                 <%=
                 "<tr>"+
                    "<td>" + inventory.getWarehouse().getName() + "</td>"+
                    "<td>" + inventory.getProduct().getName() + "</td>"+
                    "<td>" + inventory.getQuantity() + "</td>"+
                    "<td align='center'>" +
                    "<form action='../admin_pages/edit_inventory.jsp' method='POST'>" +
                    "<input type='hidden' name='inv_id' value='" + inventory.getID() + "'/>" +
                    "<input type='hidden' name='inv_warehouse_name' value='" + inventory.getWarehouse().getName() + "'/>" +
                    "<input type='hidden' name='inv_product_name' value='" + inventory.getProduct().getName() + "'/>" +
                    "<input type='hidden' name='inv_quantity' value='" + inventory.getQuantity() + "'/>" +
                    "<input type='submit' value='Edit'/>" +
                    "</form>" +
                    "</td>"+
                 "</tr>"
                 %>
                 <%
                 }
                 %>
            </tbody>
        </table>
            <form action="../admin/preaddinventory">
                <input type="submit" value="Add Inventory" />
            </form>
    </body>
</html>
